package com.zhx.basis.设计模式.观察者模式.demo1;

import java.util.Date;

public class LotteryServiceImpl extends LotteryService {


    @Override
    protected LotteryResult doDraw(String uId) {
        // 摇号
        String lottery =lottery(uId);
        // 结果
        return new LotteryResult(uId, lottery, new Date());
    }

    public String lottery(String uId) {
        return Math.abs(uId.hashCode()) % 2 == 0 ? "恭喜你，编码".concat(uId).concat("在本次摇号中签") : "很遗憾，编码".concat(uId).concat("在本次摇号未中签或摇号资格已过期");
    }

}
